#include <cstdio>
#include <stack>
#include <queue>
using namespace std;

queue<int> ans;
stack<int> track;

int main() {
	char e;
	int n;
	scanf("%d\n", &n);
	int np = 1;
	for (int i = 1; i <= n; ++i) {
		scanf("%c", &e);
		if (e == 'A') {
			ans.push(np++);
		} else if (e == 'B') {
			if (track.size() >= 5) {
				printf("No\n");
				return 0;
			}
			track.push(np++);
		} else if (e == 'C') {
			if (track.empty()) {
				printf("No\n");
				return 0;
			}
			ans.push(track.top());
			track.pop();
		}
	}
	printf("Yes\n");
	while (!ans.empty()) {
		printf("%d\n", ans.front());
		ans.pop();
	}
	return 0;
}
